package serverx

import (
	"github.com/gin-contrib/cors"
	"github.com/gin-gonic/gin"
)

// WithCors 跨域
func WithCors(headers ...string) gin.HandlerFunc {
	corsConfigs := cors.DefaultConfig()
	corsConfigs.AllowAllOrigins = true
	corsConfigs.AddAllowHeaders(headers...)
	return cors.New(corsConfigs)
}
